//
//  LEGoodsListController.m
//  LoveExpressBusiness
//
//  Created by 刘甲奇 on 2017/5/15.
//  Copyright © 2017年 DFH. All rights reserved.
//

#import "LEGoodsListController.h"
#import "LEStorageController.h"
#import "LEOnSaleController.h"
#import "LESaleOutController.h"
#import "LEWaitCheckController.h"
#import "LECheckFailedController.h"

#import "LEAddGoodsController.h"

@interface LEGoodsListController ()

@end

@implementation LEGoodsListController

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.tabBarController.tabBar setHidden:YES];
    self.title = @"商品列表";
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithTitle:@"添加商品" style:UIBarButtonItemStylePlain target:self action:@selector(addClick)];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    //分割线
    UIView *lineView = [[UIView alloc] init];
    [self.menuView addSubview:lineView];
    lineView.frame = CGRectMake(0, 39, LEScreenWidth, 1);
    lineView.backgroundColor = LEBackgroundColor;
}

#pragma mark- WMPageControllerDataSource
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController
{
    return 5;
}

- (__kindof UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index
{
    if (index == 0) {
        return [[LEOnSaleController alloc]init];
    }else if(index == 1){
        LEStorageController *storage = [[LEStorageController alloc] init];
        return storage;
    }else if(index == 2){
        return [[LESaleOutController alloc]init];
    }else if (index == 3){
        return [[LEWaitCheckController alloc]init];
    }
    else {
        return [[LECheckFailedController alloc]init];
    }
    
}

- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index
{
    
    if (index == 0)
    {
        return @"出售中";
    }else if (index == 1)
    {
        return @"仓库中";
    }else if (index == 2)
    {
        return @"已售罄";
    }else if (index == 3)
    {
        return @"等待审核";
    }else{
        return @"审核失败";
    }
    
}
#pragma mark- 点击事件
- (void)addClick
{
    LELog(@"%s---%d---添加商品",__func__,__LINE__);
    LEAddGoodsController *add = [[LEAddGoodsController alloc] init];
    [self.navigationController pushViewController:add animated:YES];
}


@end
